package cn.biplam.front.component.view.systemManage.menu.thirdTree;

import cn.biplam.common.client.DbResource;
import cn.biplam.common.tools.TOOLS;
import cn.biplam.common.wrapper.ErrorMessage;
import cn.biplam.common.wrapper.UserInfo;
import cn.biplam.front.component.AjxResponse;
import cn.biplam.front.component.data.tree.TreeData;
import cn.biplam.front.component.data.tree.TreeIndexData;
import cn.biplam.front.component.view.systemManage.menu.MenuTreeThird.Menu_Type;
import cn.biplam.front.html.base.HtmlWindow;
import cn.biplam.front.template.callback.TreeCallBack;
import cn.biplam.front.template.callback.tree.SystemRuleTreeCallBack;
import cn.biplam.front.template.control.Tree;

/**
 * 系统维护规则导航树
 * @author WangSong 2009-6-15下午05:03:14
 * @version 1.0
 */
public class SystemRuleTree extends AjxResponse{
	
	public static String tableName = "menu_third";
	/**三级导航类型，这个类型和OperatorType分开，在取根节点时用过过滤条件 */
	private String nodeType = Menu_Type.System.toString();
	
	public SystemRuleTree(UserInfo mUser,String sHomeUrl){
		this.mUser = mUser;
		this.sHomeUrl = sHomeUrl;
	}
	
	/**
	 * 返回回调函数，这个函数提供 获取TreeData数据所需的operatorId
	 */
	public TreeCallBack getCallBack(String targetID,String actionId){
		return new SystemRuleTreeCallBack(targetID,actionId);
	}
	
	/**
	 *  设置取指定节点的子树参数信息
	 * @param userID      用户ID
	 * @param nodeId      当前节点id
	 * @param nodeLevel   当前节点级别
	 * @param levelDown   向下取几级数据 -1 全部 0 当前  1 当前节点下1级 2当前节点向下2级 ... n当前节点向下n级
	 * @param parentsHaveLBrother  父亲们是否有弟弟
	 * @param dbr      数据操作数据源
	 * @throws ErrorMessage
	 */
	public TreeData getTreeData(String userID,
            String nodeId,
            String nodeLevel,
            String levelDown,
            String haveBrother,
            String haveLBrother,
            String parentsHaveLBrother,
            DbResource dbr) throws ErrorMessage{
		TreeIndexData tid = new TreeIndexData();
		tid.setData(tableName, userID, nodeId,nodeLevel, levelDown,nodeType,
				haveBrother,haveLBrother,parentsHaveLBrother);
		//设置虚根
		tid.setVirtualRootNode("系统基础维护", null);
		tid.setLevelDown(TOOLS.stringToInt(levelDown));
		tid.create();
		return tid;
	}
	
	/**
	 * 增删改操作
	 */
	@Override
	protected HtmlWindow ajxGet() throws ErrorMessage {
		return null;
	}
	
	/**
	 * 右键菜单页面
	 * @return
	 * @throws ErrorMessage 
	 */
	public void setRightMenu(Tree mTree) throws ErrorMessage{
		
	}
}
